<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('单向导入前置系统')" />
    <link th:href="@{/css/login.css}" type="text/css" rel="stylesheet">
    <link th:href="@{/css/style.css}" type="text/css" rel="stylesheet">

    <style type="text/css">
        label.error {
            position: inherit;
            color: red;
        }
    </style>
    <script>
        if (window.top !== window.self) {
            window.top.location = window.location
        }
        ;
    </script>

</head>

<body class="signin">
<div id="container">
    <div id="output">
        <div class="signinpanel">
            <div class="row">
                <div class="col-sm-12">
                    <h5 style="font-size: 40px;text-align:center;color: #1a2226">前置系统</strong></h5>
                </div>
                <div class="col-sm-12">
                    <br>
                    <br>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-1"></div>
                <div class="col-sm-10" style="padding: 0 100px 0 100px;">
                    <form id="signupForm" method="post" onsubmit="return false" th:action="@{/doLogin}">
                        <h4 class="no-margins">登录：</h4>
                        <input type="text" name="userName" autocomplete="off" class="form-control uname" placeholder="用户名"/>
                        <input type="password" name="password" autocomplete="off" class="form-control pword" placeholder="密码"/>
                        <button class="btn btn-success btn-block" id="btnSubmit" data-loading="正在验证登录，请稍后...">登录
                        </button>
                    </form>
                </div>
                <div class="col-sm-1"></div>
            </div>
            <div class="signup-footer">
                <div class="pull-left">
                    Copyright©2019 版权所有 中国航天科工集团有限公司 备案序号:京ICP备05067351号<br>
                    制作单位：中国航天科工集团第二研究院北京计算机技术及应用研究所<br>
                    地址：北京市海淀区永定路52号　邮编：100854 <br>
                </div>
            </div>
        </div>
    </div>
</div>
<div style="display: none"  id="msg">[[${msg}]]</div>
<!-- 全局js -->
<th:block th:include="include :: common-js" />
<!--界面-->
<th:block th:include="include :: vector-js" />
<!--表单验证-->
<th:block th:include="include :: validate-js" />
<script type="text/javascript">
    $(function () {
        //初始化背景插件
        Victor("container", "container");
        var msg = $("#msg").text();
        console.log(msg);
        if (msg!=null&&msg!=""){
            layer.msg(msg);
        }

        //提交表单
        $("#btnSubmit").click(function(){

            //检测该用户是否已经登录


            $("#signupForm").validate({

                //debug:true,//试模式，即使验证成功也不会跳转到目标页面
                rules:{
                    userName:{
                        required:true,
                        rangelength:[1,20]
                    },
                    password:{
                        required:true,
                        rangelength:[1,20]
                    }
                },
                messages:{
                    userName:{
                        required:"该项必须填写",
                        rangelength:"请输入1-3个字符"
                    },
                    password:{
                        required:"该项必须填写",
                        rangelength:"请输入1-3个字符"
                    }

                },

                submitHandler:function(form){
                    form.submit();
                }
            })
        })
    });
</script>
</body>
</html>
